DepUsersView = Ext.extend(Ext.Panel, {
	constructor : function(a) {
		Ext.applyIf(this, a);
		this.initUIComponents();
		DepUsersView.superclass.constructor.call(this, {
			id : "DepUsersView",
			title : "[DepUsers]管理",
			region : "center",
			layout : "border",
			items : [ this.searchPanel, this.gridPanel ]
		});
	},
	initUIComponents : function() {
		this.searchPanel = new HT.SearchPanel({
			layout : "form",
			region : "north",
			colNums : 3,
			items : [ {
				fieldLabel : "",
				name : "Q_userid_L_EQ",
				flex : 1,
				xtype : "numberfield"
			}, {
				fieldLabel : "",
				name : "Q_depid_L_EQ",
				flex : 1,
				xtype : "numberfield"
			}, {
				fieldLabel : "",
				name : "Q_ismain_SN_EQ",
				flex : 1,
				xtype : "numberfield"
			}, {
				fieldLabel : "",
				name : "Q_sn_N_EQ",
				flex : 1,
				xtype : "numberfield"
			} ],
			buttons : [ {
				text : "查询",
				scope : this,
				iconCls : "btn-search",
				handler : this.search
			}, {
				text : "重置",
				scope : this,
				iconCls : "btn-reset",
				handler : this.reset
			} ]
		});
		this.topbar = new Ext.Toolbar({
			items : [ {
				iconCls : "btn-add",
				text : "添加[DepUsers]",
				xtype : "button",
				scope : this,
				handler : this.createRs
			}, {
				iconCls : "btn-del",
				text : "删除[DepUsers]",
				xtype : "button",
				scope : this,
				handler : this.removeSelRs
			} ]
		});
		this.gridPanel = new HT.GridPanel({
			region : "center",
			tbar : this.topbar,
			rowActions : true,
			id : "DepUsersGrid",
			url : __ctxPath + "/system/listDepUsers.do",
			fields : [ {
				name : "depuserid",
				type : "int"
			}, "userid", "depid", "ismain", "sn" ],
			columns : [ {
				header : "depuserid",
				dataIndex : "depuserid",
				hidden : true
			}, {
				header : "",
				dataIndex : "userid"
			}, {
				header : "",
				dataIndex : "depid"
			}, {
				header : "",
				dataIndex : "ismain"
			}, {
				header : "",
				dataIndex : "sn"
			}, new Ext.ux.grid.RowActions({
				header : "管理",
				width : 100,
				actions : [ {
					iconCls : "btn-del",
					qtip : "删除",
					style : "margin:0 3px 0 3px"
				}, {
					iconCls : "btn-edit",
					qtip : "编辑",
					style : "margin:0 3px 0 3px"
				} ],
				listeners : {
					scope : this,
					"action" : this.onRowAction
				}
			}) ]
		});
//		this.gridPanel.addListener("rowdblclick", this.rowClick);
	},
	reset : function() {
		this.searchPanel.getForm().reset();
	},
	search : function() {
		$search({
			searchPanel : this.searchPanel,
			gridPanel : this.gridPanel
		});
	},
	rowClick : function(b, a, c) {
		b.getSelectionModel().each(function(d) {
			new DepUsersForm({
				depuserid : d.data.depuserid
			}).show();
		});
	},
	createRs : function() {
		new DepUsersForm().show();
	},
	removeRs : function(a) {
		$postDel({
			url : __ctxPath + "/system/multiDelDepUsers.do",
			ids : a,
			grid : this.gridPanel
		});
	},
	removeSelRs : function() {
		$delGridRs({
			url : __ctxPath + "/system/multiDelDepUsers.do",
			grid : this.gridPanel,
			idName : "depuserid"
		});
	},
	editRs : function(a) {
		new DepUsersForm({
			depuserid : a.data.depuserid
		}).show();
	},
	onRowAction : function(c, a, d, e, b) {
		switch (d) {
		case "btn-del":
			this.removeRs.call(this, a.data.depuserid);
			break;
		case "btn-edit":
			this.editRs.call(this, a);
			break;
		default:
			break;
		}
	}
});